package com.example.houduan.controller;

import com.example.houduan.entity.User;
import com.example.houduan.service.UserService;
import com.example.houduan.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/login")
    public Result login(User user){
        return Result.success(userService.getUserByusername(user));
    }
    @PostMapping("/register")
    public Result register(@RequestBody User user){
        return Result.success(userService.registry(user));
    }

}
